﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace OMS.Models
{
    public class LoginModel
    {

        [Required(ErrorMessage = "Please enter name")]
        [Display(Name = "User name")]   
        public string UserName { get; set; }

       
        [DataType(DataType.Password)]
        [Required(ErrorMessage = "Please enter password")]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [Display(Name = "Remember me?")]
        public bool RememberMe { get; set; }
    }

    public class CreateUser
    {
        [Display(Name = "Login Name")]
        [Required(ErrorMessage = "Login Name cannot be blank")]
        [StringLength(50, MinimumLength = 3, ErrorMessage = "The string length must be between 3 and 50 characters")]
        [Remote("CheckUserName","Administration", ErrorMessage="This username already exist")]
        public string LoginName { get; set; }

        [Display(Name = "First Name")]
        [Required(ErrorMessage = "First Name cannot be blank")]
        [StringLength(30, MinimumLength = 3, ErrorMessage = "The string length must be between 3 and 30 characters")]
        public string FirstName { get; set; }

        [Display(Name = "Last Name")]
        [Required(ErrorMessage = "Last Name cannot be blank")]
        [StringLength(30, MinimumLength = 3, ErrorMessage = "The string length must be between 3 and 30 characters")]
        public string LastName { get; set; }


        [DataType(DataType.Password)]
        [Required(ErrorMessage = "Password cannot be blank")]
        public string Password { get; set; }

        [Required(ErrorMessage = "You must to repeat the password")]
        [System.Web.Mvc.Compare("Password", ErrorMessage = "Passwords do not match")]
        [DataType(DataType.Password)]
        public string PasswordConfirm { get; set; }

        [Required(ErrorMessage = "Email cannot be blank")]
        [Remote("CheckEmail", "Administration", ErrorMessage = "This email already exist")]
        [DataType(DataType.EmailAddress)]
        [EmailAddress]
        public string Email { get; set; }

        [Required(ErrorMessage = "Region cannot be blank")]
        public string Region { get; set; }

        [Required(ErrorMessage = "Role cannot be blank")]
        public int Role { get; set; }
    }

    public class EditUser
    {
        [Display(Name = "Login Name")]
        [StringLength(50, MinimumLength = 3, ErrorMessage = "The string length must be between 3 and 50 characters")]
        public string LoginName { get; set; }

        [Display(Name = "First Name")]
        [Required(ErrorMessage = "First Name cannot be blank")]
        [StringLength(30, MinimumLength = 3, ErrorMessage = "The string length must be between 3 and 30 characters")]
        public string FirstName { get; set; }

        [Display(Name = "Last Name")]
        [Required(ErrorMessage = "Last Name cannot be blank")]
        [StringLength(30, MinimumLength = 3, ErrorMessage = "The string length must be between 3 and 30 characters")]
        public string LastName { get; set; }


        [DataType(DataType.Password)]
        [Required(ErrorMessage = "Password cannot be blank")]
        public string Password { get; set; }

        [Required(ErrorMessage = "You must to repeat the password")]
        [System.Web.Mvc.Compare("Password", ErrorMessage = "Passwords do not match")]
        [DataType(DataType.Password)]
        public string PasswordConfirm { get; set; }

        [Required(ErrorMessage = "Email cannot be blank")]
       // [Remote("CheckEmail", "Administration", ErrorMessage = "This email already exist")]
        [DataType(DataType.EmailAddress)]
        [EmailAddress]
        public string Email { get; set; }

        [Required(ErrorMessage = "Region cannot be blank")]
        public string Region { get; set; }

        [Required(ErrorMessage = "Role cannot be blank")]
        public int Role { get; set; }
    }

}